<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!doctype html>
<html lang="zh-CN">
<head>
<meta
	content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
	name="viewport" />
<meta charset="utf-8">
<title>来存吧下载</title>
<style type="text/css">
html, body {
	padding: 0px;
	margin: 0px;
	width: 100%;
	height: 100%;
}
img{
	box-sizing: border-box;
	max-width: 100%;
	height: auto;
	vertical-align: middle;
	border: 0;
}
.input_box,#btnDownload {
	position: absolute;
}
.input_box {
	border-radius: 5px 0 0 5px;
	padding: 10px 15px;
	background-color: #b3220e!important;
	width: 100%;
	box-sizing: border-box;
	position: fixed;
	bottom: 0px;
	left: 0;
}
.input_box input {
	border-radius: 5px;
	outline: none;
	border: none;
	padding: 0 0 0 10px;
	background-color: #fd513b!important;
	color: #fff;
	font-size: 18px;
	height: 50px;
}

#errorShow {
	position: absolute;
	color: #000;
	font-size: 18px;
	font-weight: bold;
	left: 20px;
	top: -20px;
}

#btnDownload {
	height: 50px;
}

::-webkit-input-placeholder {
	color:#fff;
}
:-moz-placeholder {
	color:#fff;
}
::-moz-placeholder {
	color:#fff;
}
:-ms-input-placeholder {
	color:#fff;
}
#wrapper {
	overflow-y: scroll;
	width: 100%;
	position: absolute;
	left: 0;
	right: 0;
	top: 0px;
	bottom: 70px;
	-webkit-overflow-scrolling: touch;
	z-index: 100;
}
</style>
<script type="text/javascript" src="mi-sports.js" /></script>
</head>
<body style="background: #ef3440;">
	<div id="wrapper">
		<img src="http://laicunba.b0.upaiyun.com/lcb/activity/download_app_0717.jpg" />
	</div>
	<div class="input_box"><div id="errorShow"></div>
		<input type="tel" id="mobile" placeholder="请输入手机号码" />&nbsp;<img id="btnDownload" src="img/btn-download.png" />
	</div>

	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript">
		$(function() {
			$("#btnDownload").click(function() {
				$("#errorShow").html("");
				var mobile = $("#mobile").val().trim();
				if (!mobile) {
					$("#mobile").focus();
					$("#errorShow").html("请输入手机号码");
					return;
				};
				if (!(/^1[0-9]{10}$/.test(mobile))) {
					$("#errorShow").html("请输入正确的手机号码!");
					return;
				};
				$.post("download_app_0717.htm?mobile=" + mobile, '', function(data) {
					if(data.status == '1' || data.status == '2') {
						var u = navigator.userAgent;
						var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
						var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
						if(isAndroid) {
							openUrl("https://cdn.laicunba.com/lcb//laicunba_26.apk");
						} else if(isiOS) {
							openUrl("https://itunes.apple.com/cn/app/lai-cun-ba-li-cai-gao-shou/id1087649876?mt=8");
						}
					}
				}, "json");
			});
			
			$(".input_box input").click(function(){
				$("#errorShow").html("");
			})
			
			var	ratio = $(window).width()/750;
			function rdist(num){
				return Math.floor(ratio*num) + "px";
			};
			$(".input_box input").css({
				width: rdist(430),
			})
		
			$("#wrapper").click(function() {
				$(".input_box input").blur();
			});
		});
		
		function openUrl(url) {
			if(HMJsBridge.isSupport()) {
				HMJsBridge.HMJsBridgeReady(function() {
					HMJsBridge.preVerifyJsApi({
						env: "",
						jsApiList: ["openInBrowser"]
					},function(data) {
						if(data.status == 'success') {
							HMJsBridge.openInBrowser({"url": url}, function(data) {
								console.log(data);
							});
						}
					});
				});
			}
		}
	</script>
</body>
</html>